package com.dxy.yesas2020goals.study.others.enumlearn.v1;

/**
 * @author victorydeng
 * @Classname Season 不使用枚举类的情况
 * @Description TODO
 * @Date 2020/5/12 9:43
 * @Created by victorydeng
 */
public class Season {
    private Season(){

    }
    /* 春季 */
    public static final Season SPRING = new Season();
    /* 夏季 */
    public static final Season SUMMER = new Season();
    /* 秋季 */
    public static final Season AUTUMN = new Season();
    /* 冬季 */
    public static final Season WINTER = new Season();

    /**
     * @param nowSeason
     * @return nextSeason
     */
    public static  Season getNextSeason(Season nowSeason) {
        if(nowSeason == SPRING) {
            return SUMMER;
        } else if(nowSeason == SUMMER){
            return AUTUMN;
        } else if (nowSeason == AUTUMN) {
            return WINTER;
        } else {
            return SPRING;
        }
    }

    /**
     *
     * @param nowSeason
     */
    public static void printNowSeason(Season nowSeason){
        if(nowSeason == SPRING){
            System.out.println("春季");
        }else if(nowSeason == SUMMER){
            System.out.println("夏季");
        }else if(nowSeason == AUTUMN){
            System.out.println("秋季");
        }else{
            System.out.println("冬季");
        }
    }

    /**
     *
     * @param nowSeason
     * @return
     */
    public static int toInt(Season nowSeason){
        if(nowSeason == SPRING){
            return 1;
        }else if(nowSeason == SUMMER){
            return 2;
        }else if(nowSeason == AUTUMN){
            return 3;
        }else{
            return 4;
        }
    }

    public static void main(String[] args){
        Season nowSeason = Season.SUMMER;
        Season.printNowSeason(nowSeason);
        Season nextSeason = Season.getNextSeason(nowSeason);
        Season.printNowSeason(nextSeason);
    }






}
